package com.pervasive.geoTagging;

import android.app.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class NoteActivity extends Activity {

	public void onCreate(Bundle savedInstanceState){	   
		 super.onCreate(savedInstanceState);
		 setContentView(R.layout.main_gallery2);
		 final EditText  myEditText = (EditText) findViewById(R.id.editText1);
		 Button b = (Button) findViewById(R.id.button1);

		 Intent i = this.getIntent();
		 final int cod = (Integer) i.getExtras().get("Codice");
		 if(cod == 2)
			 myEditText.setText((CharSequence) i.getExtras().get("Note"));
		 
		 b.setOnClickListener(new OnClickListener() {
				public void onClick(View v) {
					Intent res = null;
					if(cod == 1)
						res = new Intent(NoteActivity.this, SaveActivity.class);
					else if(cod == 2)
						res = new Intent(NoteActivity.this, CustomGalleryActivity.class);
					res.putExtra("Note", myEditText.getText().toString());
					setResult(Activity.RESULT_OK, res);
					finish();
				}
		});
	}  
}